from flask import Flask
from flask import request
from flask import redirect

import bc
from bc_constants import PATH_WORKROOM

app = Flask(__name__, static_folder=PATH_WORKROOM + 'data', static_url_path="/data")


@app.route("/")
def hello():
    return "Hello World!"


@app.route("/generate_bc")
def generate_bc():
    file_path_report, relative_path_report = bc.generate_bc("")
    return redirect('http://' + request.host + '/data/' + relative_path_report)


if __name__ == "__main__":
    app.run(host='0.0.0.0', port=9988)
